<%--
  Created by IntelliJ IDEA.
  User: asus
  Date: 2020/6/3
  Time: 16:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="true"%>
<html>
<head>
    <title>盘盈盘亏查询</title>
    <%@include file="/comm/head.jsp"%>
</head>
<body>
<div id="root">
    <Collapse value="search">
        <Panel name="search">
            条件查询
            <p slot="content">
                <i-form inline :label-width="70">

                    <form-item label="登记日期:">
                        <row>
                            <col span="12"> <date-picker @on-change="pkykVo.startDate=$event"  placeHolder="请输入起始日期" style="width: 150px" type="date" ></date-picker></col>
                            <col span="12"> <date-picker @on-change="pkykVo.endDate=$event"   placeHolder="请输入结束日期" style="width: 150px" type="date" ></date-picker></col>
                        </row>
                    </form-item>
                    <form-item label="审核日期:">
                        <row>
                            <col span="12"> <date-picker @on-change="pkykVo.startDate2=$event"  placeHolder="请输入起始日期" style="width: 150px" type="date" ></date-picker></col>
                            <col span="12"> <date-picker @on-change="pkykVo.endDate2=$event"   placeHolder="请输入结束日期" style="width: 150px" type="date" ></date-picker></col>
                        </row>
                    </form-item>
                    <form-item label="类型:" prop="type">
                        <radio-group v-model="pkykVo.type">
                            <radio :label="1">盘盈</radio>
                            <radio :label="2">盘亏</radio>
                        </radio-group>
                    </form-item>
                    <i-button type="primary" style="margin-left:20px" @click="pageNo=1;search();">搜索</i-button>
                </i-form>
            </p>
        </Panel>
    </Collapse>
    <i-table :columns="columns" :data="pageResult.rows"  :height="300"  @on-selection-change="tableSelection=arguments[0]"  border stripe>
        <template slot-scope="{row}" slot="name">
            <span>{{row.goods.name}}</span>
        </template>
        <template slot-scope="{row}" slot="sname">
            <span>{{row.store.sname}}</span>
        </template>
        <template slot-scope="{row}" slot="username">
            <span>{{row.user.username}}</span>
        </template>
        <template slot-scope="{row}" slot="state">
            <span>{{row.state==0?"未审核":"已审核"}}</span>
        </template>
        <template slot-scope="{row}" slot="type">
            <span>{{row.type==1?"盘盈":"盘亏"}}</span>
        </template>
    </i-table>

    <Page :total="pageResult.total"
          :page-size="pageSize"
          @on-change="pageNo=arguments[0];search();"
          show-sizer
          :page-size-opts="[5,10,15]"
          @on-page-size-change="pageSize=arguments[0];search();"
    />

</div>
<script>
    new Vue({
        el:"#root",
        data:{

            columns:[
                { key:"id",title:"编号"},
                {slot:"sname",title:"仓库"},
                {slot:"name",title:"商品"},
                {title:"数量",key: "num"},
                {title:"类型",slot: "type"},
                {title:"登记日期",key: "createtime"},
                {title:"审核日期",key: "checktime"},
                {title:"登记人",slot: "username"},
                {title:"审核人",slot: "username"},
                {title:"状态",slot: "state"},
            ],
            pageResult:{
                rows:[],
                total:50
            },
            pageNo:1,
            pageSize:5,
            tableSelection:[],
            pkykVo:{},
            panyingpankui:{},
            addFlag:false,
            goodsList:[],
            storeList:[],

        },
        methods:{
            search(){
                axios.get(`${ctx}/kucun/pkyk/search/${this.pageNo}/${this.pageSize}`,{params:this.pkykVo})
                    .then(({data})=>{
                        this.pageResult=data.result;
                        console.log(data.result)
                    });
            },
        },
        mounted(){
            this.search();
        }
    });
</script>
</body>
</html>
